Skip to content

Commit

Permalink
patches to build on freebsd 12
Browse files Browse the repository at this point in the history
- added cc and ar scripts for freebsd12.amd64
- fix for sfio macro SF_FLAGS also being defined for sendfile(2) in socket.h
-- fix is to hide the sendfile(2) macro
- defined _STDFILE_DECLARED to handle FILE macro incompatibility
- added test in std/features/procfs to deal with freebsd kvm interface
-- being different from what AST expects (for ps.c)
- fix for std/banner.c to clean up main() definition
- changed comment in ar.* scripts to match cc.* scripts
  • Loading branch information
Lefteris Koutsofios committed Feb 24, 2020
1 parent a30e7b7 commit 2cf1ffd
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/cmd/INIT/ar.freebsd12.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
: linux.i386-64 ar wrapper

case $1 in
*x*) /usr/bin/ar "$@" ;;
*) /usr/bin/ar U"$@" ;;
esac
2 changes: 1 addition & 1 deletion src/cmd/INIT/ar.linux.i386-64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
: stupid stupid stupid to require a non-standard option for ar to work : 2009-10-06 :
: linux.i386-64 ar wrapper

case $1 in
*x*) /usr/bin/ar "$@" ;;
Expand Down
9 changes: 9 additions & 0 deletions src/cmd/INIT/cc.freebsd12.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
: linux.i386-64 cc wrapper : 2006-02-14 :

HOSTTYPE=freebsd12.amd64

case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac

/usr/bin/cc -P "$@"
3 changes: 1 addition & 2 deletions src/cmd/std/banner.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,14 @@ static void banner(const char *string,const char *delim,int width)
}

int
main(int argc, char *argv[], void *extra)
main(int argc, char *argv[])
{
register int n;
register char *cp;
char *delim = "#";
int width = 80;

NoP(argc);
NoP(extra);
error_info.id = "banner";
while (n = optget(argv, usage)) switch (n)
{
Expand Down
7 changes: 7 additions & 0 deletions src/cmd/std/features/procfs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ sys procfs,sysctl

lib getprocs
lib kvm_open,kvm_getprocs kvm.h sys/time.h sys/param.h sys/proc.h sys/sysctl.h -lkvm
typ struct.kinfo_proc kvm.h sys/time.h sys/param.h sys/proc.h sys/sysctl.h
lib pstat_getproc sys/param.h sys/pstat.h

cat{
#ifndef _typ_struct_kinfo_proc
#undef _lib_kvm_open
#endif
}end

mem extern_proc.p_pid,extern_proc.p_starttime,extern_proc.p_wchan,extern_proc.p_usrpri,extern_proc.p_addr,eproc.e_xsize sys/time.h sys/param.h sys/proc.h sys/sysctl.h -lkvm
mem procsinfo64.pi_pri procinfo.h
mem prpsinfo.pr_clname,prpsinfo.pr_cstime,prpsinfo.pr_cstime.tv_sec,prpsinfo.pr_ctime,prpsinfo.pr_cutime,prpsinfo.pr_gid,prpsinfo.pr_lttydev,prpsinfo.pr_ntpid,prpsinfo.pr_pgid,prpsinfo.pr_pgrp,prpsinfo.pr_psargs,prpsinfo.pr_refcount,prpsinfo.pr_rssize,prpsinfo.pr_sid,prpsinfo.pr_sonproc,prpsinfo.pr_start,prpsinfo.pr_start.tv_sec,prpsinfo.pr_starttime,prpsinfo.pr_starttime.tv_sec,prpsinfo.pr_state,prpsinfo.pr_stime,prpsinfo.pr_tgrp,prpsinfo.pr_time,prpsinfo.pr_time.tv_sec,prpsinfo.pr_utime,prpsinfo.pr_zomb,prpsinfo.pr_pctcpu,prpsinfo.pr_cpu,prpsinfo.pr_lwp.pr_pctcpu,prpsinfo.pr_lwp.pr_cpu -D_STRUCTURED_PROC -Dprpsinfo=psinfo sys/types.h sys/procfs.h
Expand Down
2 changes: 2 additions & 0 deletions src/lib/libast/features/sfio
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ sys filio,ioctl
lib qfrexp,qldexp
key signed

typ struct.sf_hdtr sys/socket.h

tst - note{ number of bits in pointer }end output{
#include <stdio.h>
int
Expand Down
3 changes: 3 additions & 0 deletions src/lib/libast/features/wchar
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set include .
cat{
#ifndef _AST_WCHAR_H
#define _AST_WCHAR_H 1
#ifdef __FreeBSD__
#define _STDFILE_DECLARED 1
#endif
}end

lib mbstowcs,wctomb,wcrtomb,wcslen,wcstombs,wcwidth stdlib.h stdio.h wchar.h
Expand Down
7 changes: 7 additions & 0 deletions src/lib/libast/include/sfio.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ struct _sffmt_s
#define SF_WCWIDTH 0100000 /* wcwidth display stream */

#define SF_FLAGS 0177177 /* PUBLIC FLAGS PASSABLE TO SFNEW() */
#ifdef _typ_struct_sf_hdtr
#define _SF_HIDESFFLAGS 1
#endif
#define SF_SETS 0177163 /* flags passable to sfset() */

#ifndef _SF_NO_OBSOLETE
Expand Down Expand Up @@ -454,4 +457,8 @@ __INLINE__ ssize_t sfmaxr(ssize_t n, int s) { return __sf_maxr(n,s); }

#endif /* _SFSTR_H */

#ifdef _SF_HIDESFFLAGS
#undef SF_FLAGS
#define SF_FLAGS 0177177 /* PUBLIC FLAGS PASSABLE TO SFNEW() */
#endif
#endif /* _SFIO_H */
5 changes: 5 additions & 0 deletions src/lib/libast/sfio/sfhdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1305,4 +1305,9 @@ extern int poll _ARG_((ulong, struct pollfd*, int));

_END_EXTERNS_

#ifdef _SF_HIDESFFLAGS
#undef SF_FLAGS
#define SF_FLAGS 0177177 /* PUBLIC FLAGS PASSABLE TO SFNEW() */
#endif

#endif /*_SFHDR_H*/

0 comments on commit 2cf1ffd

Please sign in to comment.